Skip to content

fix(openai-adapters): allow disabling stream_options for strict OpenAI-compatible endpoints#12992

Open
devYRPauli wants to merge 1 commit into
continuedev:mainfrom
devYRPauli:fix/openai-stream-options-opt-out
Open

fix(openai-adapters): allow disabling stream_options for strict OpenAI-compatible endpoints#12992
devYRPauli wants to merge 1 commit into
continuedev:mainfrom
devYRPauli:fix/openai-stream-options-opt-out

Conversation

@devYRPauli

Copy link
Copy Markdown

Problem

The OpenAI adapter always adds stream_options: { include_usage: true } to streaming requests. Strict OpenAI-compatible endpoints (for example Databricks serving endpoints) reject unknown fields and return 400 unknown field "stream_options", so Continue cannot talk to them even though the endpoint works when called directly.

Fix

Adds an optional streamOptions boolean to the model config, mirroring the existing useResponsesApi opt-out. Default behavior is unchanged: stream_options is still injected when streaming. Setting streamOptions: false skips it, letting strict endpoints work:

models:
  - name: Databricks
    provider: openai
    model: <endpoint>
    apiBase: https://<workspace>/serving-endpoints
    apiKey: <token>
    streamOptions: false

The field is declared in both the openai-adapters schema and the config-yaml model schema, and gated in modifyChatBody (body.stream && this.config.streamOptions !== false).

Test

Added a test asserting stream_options.include_usage is present by default and absent when streamOptions: false. openai-adapter.vitest.ts passes (5 tests).

Fixes #12936.

@devYRPauli
devYRPauli requested a review from a team as a code owner July 16, 2026 16:42
@devYRPauli
devYRPauli requested review from sestinj and removed request for a team July 16, 2026 16:42
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 16, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

model: model.model,
apiKey: model.apiKey,
apiBase: model.apiBase,
requestOptions: model.requestOptions,
env: model.env,

P2 Badge Forward streamOptions from model configs

When a CLI model specifies streamOptions: false (now accepted by the YAML schema), this adapter config drops that field before calling constructLlmApi; OpenAIApi.modifyChatBody therefore sees the default undefined and still adds stream_options, so the new escape hatch does not work for CLI/headless users hitting strict OpenAI-compatible endpoints.


const target = redirectTo.startsWith("http")
? redirectTo
: `/docs${redirectTo}`;

P2 Badge Use standalone docs paths for internal redirects

For internal redirects from docs.json such as /customization -> /customize/overview, this sends users to /docs/customize/overview. The rest of the standalone docs app deliberately strips the /docs prefix via resolveHref, and generated pages live at /customize/overview, so these redirected URLs land on a non-existent route on the docs site.


on("models/fetch", async (msg) => {

P2 Badge Keep the license-key handler while commands still call it

This replaces the only core handler for mdm/setLicenseKey, but the VS Code continue.enterEnterpriseLicenseKey command and IntelliJ AddLicenseKey action still request that message. In those environments, invoking the enterprise license command now reaches no core handler and can no longer validate or save the key.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@devYRPauli

Copy link
Copy Markdown
Author

Same note as on my other fetch PRs: these review comments point at files outside this PR's diff. The change here only touches packages/config-yaml/src/schemas/models.ts, packages/openai-adapters/src/apis/OpenAI.ts (and its test), and packages/openai-adapters/src/types.ts. The cited extensions/cli/src/config.ts streamOptions path, the docs redirect page, and the core.ts MDM handler are not part of this changeset, so those findings do not apply here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAI provider injects stream_options causing HTTP 400 on Databricks OpenAI-compatible serving endpoints

1 participant